<template>
  <div class="main">
    <div class="head">
      <h2>某某流程图</h2>
    </div>
    <div class="content">
      <div class="left">
        <div class="left-box">
          <span>某某某某阶段</span>
        </div>
        <div class="left-box1"><span>时间线</span></div>
        <div class="left-box1"><span>某某某某线</span></div>
        <div class="left-box1"><span>某某某某线</span></div>
        <div class="left-box1"><span>某某某某线</span></div>
      </div>
      <div class="right">
        <div ref="scrollWrap" class="scroll-container">
          <div class="scroll-content">
            <div style="display: flex; flex-direction: row">
              <div v-for="index in listData.length" :key="index" class="box">
                <div class="box-title">某某阶段</div>
              </div>
            </div>

            <div class="scroll-box">
              <div class="scroll-top">
                <!-- 这里画流程图 -->
                <div id="container"></div>
              </div>
              <div class="scroll-scaleline">
                <!-- 这里是时间线展示 -->
                <!-- <div class="box-content" style="top: 20px;">
                  <span>
                    替换内容 替换内容 替换内容 替换内容
                  </span>
                </div>
                <div class="box-content" style="top: 200px;">
                  <span>
                    替换内容 替换内容 替换内容 替换内容
                  </span>
                </div> -->
              </div>
              <div class="scroll-line">
                <!-- 这里是线条一 -->
                某某线
              </div>
              <div class="scroll-line">
                <!-- 这里是线条二 -->
                某某线
              </div>
              <div class="scroll-line">
                <!-- 这里是线条三 -->
                某某线
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from "better-scroll";
import { Graph } from "@antv/x6";
export default {
  name: "HelloWorld",
  props: {
    msg: String,
  },
  data() {
    return {
      listData: Array.from({ length: 10 }), // 模拟生成10个数据项，对应展示的盒子数量
      scroll: null, // 用于存储better-scroll实例
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.initScroll();
    });
    new Graph({
      container: document.getElementById("container"),
      width: 2500,
      height: 320,
      background: {
        color: "rgba(255, 255, 128, 0.1)",
        opacity:0,
      },
    });
  },
  methods: {
  // dev修改hug测试
    initScroll() {
      const scrollWrap = this.$refs.scrollWrap;
      if (scrollWrap) {
        this.scroll = new BScroll(scrollWrap, {
          scrollX: true,
          scrollY: false,
          click: true,
          probeType: 3,
          mouseWheel: true, // 鼠标滚轮滚动
          disableMouse: false, // 启用鼠标拖动
          disableTouch: false, // 启用手指触摸
        });
      }
    },
  },
};
</script>
<style scoped>
.main {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgb(3, 12, 41);
}
.head {
  width: 100%;
  height: 60px;
  background: rgb(3, 12, 41);
  color: #8af7f3;
  display: flex;
  justify-content: center;
  align-items: center;
  background: url("/src/assets/head1.png");
  background-size: 100% 100%;
  margin-bottom: 40px;
}
.content {
  width: 100%;
  height: calc(100% - 100px);
  display: flex;
}
.left {
  display: flex;
  flex-direction: column;
  width: 5%;
  height: 100%;
  background: rgb(3, 12, 41);
}
.left-box {
  width: 100%;
  height: 60%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
  color: aqua;
  span {
    font-size: 12px;
    font-weight: bold;
    padding: 1px;
    background-color: rgb(45, 51, 49);
    color: #fff;
    width: 30px;
    /* border: 1px solid #fff; */
    text-align: center;
  }
}
.left-box1 {
  width: 100%;
  height: 10%;
  display: flex;
  justify-content: center;
  font-size: 12px;
  color: #5fb7b8;
  span {
    font-size: 12px;
    font-weight: bold;
    padding: 1px;
    width: 40px;
    text-align: center;
  }
}
.right {
  width: 95%;
  height: 100%;
  background: rgb(3, 12, 41);
}
.scroll-container {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.scroll-content {
  display: flex; /* 使用flexbox使内容横向排列 */
  width: max-content; /* 让内容的宽度自适应内容 */
  height: 100%;
  flex-direction: column;
}

.box {
  min-width: 250px;
  /* height: 100%; */
  /* margin: 2px; */
  display: flex;
  flex-direction: column;
  /* justify-content: center; */
  align-items: center;
  color: aqua;
}
.box-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 10px;
}
.scroll-box {
  width: 100%;
  height: calc(100% - 30px);
  border: #49516d solid 1px;
}
.scroll-top {
  width: 100%;
  height: calc(60% - 10px);
  box-sizing: border-box;
  padding: 10px;
  background-color: #49516d;
  color: #fff;
  display: flex;
  font-size: 15px;
  font-weight: bold;
  position: relative;
}
.box-content {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  /* height: 60px; */
  color: #fff;
  position: absolute;
  background-color: #1e5e77;
  span {
    font-size: 12px;
    font-weight: bold;
    padding: 1px;
    width: 30px;
    text-align: center;
  }
}
.scroll-scaleline {
  width: 100%;
  height: 10%;
  background-color: burlywood;
  color: #000;
}
.scroll-line {
  width: 100%;
  height: 10%;
  background-color: burlywood;
  color: #000;
}
.box-bottom {
  width: 100%;
  height: 60%;
  background-color: #49516d;
  color: #fff;
}
</style>
